// Jocara game project

#ifndef MISCELLANEOUS_H_INCLUDED
#define MISCELLANEOUS_H_INCLUDED

#include "precompiled_header.h"

enum GameModes {
  kQuit,
  kMainMenu,
  kGame
};

inline void Wait(const Uint32 frame_started) {
  const Uint32 time_passed = SDL_GetTicks() - frame_started;
  if(time_passed < 16) {
    SDL_Delay(16 - time_passed);
  }
}

SDL_Surface* LoadImage(const std::string name, const bool alpha = false);
SDL_Surface* ScaleImage(SDL_Surface* surface, const unsigned int x,
                        const unsigned int y);

void AlphaBlit(SDL_Surface* src,SDL_Rect* src_clip, SDL_Surface* dst,
               SDL_Rect* dst_clip);

extern SDL_Surface* kData[4];
extern TTF_Font* kFontSmall;
extern TTF_Font* kFontNormal;
extern TTF_Font* kFontBig;

inline bool PointInRect(const int x, const int y, SDL_Rect* rect) {
  if(x >= rect->x && x < rect->w+rect->x
      && y >= rect->y && y < rect->h+rect->y)
  return true;
  else return false;
}

#endif // MISCELLANEOUS_H_INCLUDED
